<div class="fsh-pop">
    <div id="add_form" class="layui-form">
         <input type="hidden" name="role_id" id="role_id" value="<%=role_id%>"/>
          <input type="hidden"  id="parent_id" value="<%=parentId%>"/>
          <input type="hidden"  name="status"   id="status"  value="<%=status%>"/>
          <input type="hidden"  name="createUserId"   id="createUserId"  value="<%=createUserId%>"/>
          <input type="hidden"  name="createDate"   id="createDate"  value="<%=createDate%>"/>
          <input type="hidden"  name="updateUserId"   id="updateUserId"  value="<%=updateUserId%>"/>
          <input type="hidden"  name="updateDate"   id="updateDate"  value="<%=updateDate%>"/>
        <div class="layui-form-item">
            <label class="layui-form-label"><i>*</i>名称</label>
            <div class="layui-input-block">
                <input type="text" name="roleName" lay-verify="required" placeholder="请输入关键字" class="layui-input" value="<%=roleName%>">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><i>*</i>别名</label>
            <div class="layui-input-block">
                <input name="roleKey" maxlength="20" lay-verify="required" placeholder="请输入内容" class="layui-input" value="<%=roleKey%>">
            </div>
        </div>
         <div class="layui-form-item">
            <label class="layui-form-label"><i>*</i>上级名称</label>
            <div class="layui-input-block">
              <select id="selectID" lay-filter="parent" name="parentId"  >
                
              </select>
    </div>
  </div>
    </div>
</div>
<script type="text/javascript">
        var defaultSelect = $("#parent_id").val();
        layui.use(['form'], function () {
        var form = layui.form;
          $.ajax({ 
            url:context+'/api/sysrole/list', 
            dataType:'json', 
            type:'get',
             success:function(data){    

                if(data!=undefined&&data!=null&&data!=""){
                var list = data.data;
                var html="<option value=''>请选择上级角色</option>";
                    for(var i=0;i<list.length;i++){
                        
                            html+="<option value="+list[i]["role_id"]+">"+list[i]["roleName"]+"</option>";
                                        
                     }
                       $("#selectID").append(html);
                        $("#selectID").val(defaultSelect);
                       form.render("select");
                }                                                                                                                                                                      
            
               
            }
            });
       
        });


</script>